package com.gigalaxy.game.protocol
{
	import com.netease.protobuf.*;
	import com.netease.protobuf.fieldDescriptors.*;
	import flash.utils.Endian;
	import flash.utils.IDataInput;
	import flash.utils.IDataOutput;
	import flash.utils.IExternalizable;
	import flash.errors.IOError;

	// @@protoc_insertion_point(imports)

	// @@protoc_insertion_point(class_metadata)
	public dynamic final class ReceiptData extends com.netease.protobuf.Message
	{
		public static const USERNAME:FieldDescriptor$TYPE_STRING = new FieldDescriptor$TYPE_STRING("com.gigalaxy.game.protocol.ReceiptData.userName", "userName", (1 << 3) | com.netease.protobuf.WireType.LENGTH_DELIMITED);

		private var userName$field:String;

		public function clearUserName():void
		{
			userName$field = null;
		}

		public function get hasUserName():Boolean
		{
			return userName$field != null;
		}

		public function set userName(value:String):void
		{
			userName$field = value;
		}

		public function get userName():String
		{
			return userName$field;
		}

		public static const BALANCE:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("com.gigalaxy.game.protocol.ReceiptData.balance", "balance", (2 << 3) | com.netease.protobuf.WireType.VARINT);

		private var balance$field:int;

		private var hasField$0:uint = 0;

		public function clearBalance():void
		{
			hasField$0 &= 0xfffffffe;
			balance$field = new int();
		}

		public function get hasBalance():Boolean
		{
			return (hasField$0 & 0x1) != 0;
		}

		public function set balance(value:int):void
		{
			hasField$0 |= 0x1;
			balance$field = value;
		}

		public function get balance():int
		{
			return balance$field;
		}

		public static const AMOUNT:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("com.gigalaxy.game.protocol.ReceiptData.amount", "amount", (3 << 3) | com.netease.protobuf.WireType.VARINT);

		private var amount$field:int;

		public function clearAmount():void
		{
			hasField$0 &= 0xfffffffd;
			amount$field = new int();
		}

		public function get hasAmount():Boolean
		{
			return (hasField$0 & 0x2) != 0;
		}

		public function set amount(value:int):void
		{
			hasField$0 |= 0x2;
			amount$field = value;
		}

		public function get amount():int
		{
			return amount$field;
		}

		public static const SEQUENCE:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("com.gigalaxy.game.protocol.ReceiptData.sequence", "sequence", (4 << 3) | com.netease.protobuf.WireType.VARINT);

		private var sequence$field:int;

		public function clearSequence():void
		{
			hasField$0 &= 0xfffffffb;
			sequence$field = new int();
		}

		public function get hasSequence():Boolean
		{
			return (hasField$0 & 0x4) != 0;
		}

		public function set sequence(value:int):void
		{
			hasField$0 |= 0x4;
			sequence$field = value;
		}

		public function get sequence():int
		{
			return sequence$field;
		}

		/**
		 *  @private
		 */
		override public final function writeToBuffer(output:com.netease.protobuf.WritingBuffer):void
		{
			if (hasUserName)
			{
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.LENGTH_DELIMITED, 1);
				com.netease.protobuf.WriteUtils.write$TYPE_STRING(output, userName$field);
			}
			if (hasBalance)
			{
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 2);
				com.netease.protobuf.WriteUtils.write$TYPE_INT32(output, balance$field);
			}
			if (hasAmount)
			{
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 3);
				com.netease.protobuf.WriteUtils.write$TYPE_SINT32(output, amount$field);
			}
			if (hasSequence)
			{
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 4);
				com.netease.protobuf.WriteUtils.write$TYPE_INT32(output, sequence$field);
			}
			for (var fieldKey:* in this)
			{
				super.writeUnknown(output, fieldKey);
			}
		}

		/**
		 *  @private
		 */
		override public final function readFromSlice(input:flash.utils.IDataInput, bytesAfterSlice:uint):void
		{
			var userName$count:uint = 0;
			var balance$count:uint = 0;
			var amount$count:uint = 0;
			var sequence$count:uint = 0;
			while (input.bytesAvailable > bytesAfterSlice)
			{
				var tag:uint = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input);
				switch (tag >> 3)
				{
					case 1:
						if (userName$count != 0)
						{
							throw new flash.errors.IOError('Bad data format: ReceiptData.userName cannot be set twice.');
						}
						++userName$count;
						this.userName = com.netease.protobuf.ReadUtils.read$TYPE_STRING(input);
						break;
					case 2:
						if (balance$count != 0)
						{
							throw new flash.errors.IOError('Bad data format: ReceiptData.balance cannot be set twice.');
						}
						++balance$count;
						this.balance = com.netease.protobuf.ReadUtils.read$TYPE_INT32(input);
						break;
					case 3:
						if (amount$count != 0)
						{
							throw new flash.errors.IOError('Bad data format: ReceiptData.amount cannot be set twice.');
						}
						++amount$count;
						this.amount = com.netease.protobuf.ReadUtils.read$TYPE_SINT32(input);
						break;
					case 4:
						if (sequence$count != 0)
						{
							throw new flash.errors.IOError('Bad data format: ReceiptData.sequence cannot be set twice.');
						}
						++sequence$count;
						this.sequence = com.netease.protobuf.ReadUtils.read$TYPE_INT32(input);
						break;
					default:
						super.readUnknown(input, tag);
						break;
				}
			}
		}

	}
}
